<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/9/19 16:19
 * Desc: 会员信息
 */
class Request_Api_V2_Member_Info extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);

        $this->validation->rule('mid', ['Rule_Member', 'need_member']);
    }

    public function show()
    {
        return $this;
    }

    public function reset_password()
    {
        $this->rules = [
            ['old_pwd', ['not_empty', $this->rule_min_length(6)]],
            ['pwd', ['not_empty', $this->rule_min_length(6)]]
        ];

        return $this;
    }

    public function modify()
    {
        return $this;
    }

    public function statistic()
    {
        return $this;
    }

    public function bind()
    {
        $this->rules = [
            ['msgtype', ['not_empty']],
            ['captcha_key', ['not_empty']],
            ['code', ['not_empty']],
            ['msg_code', ['not_empty']],
        ];

        if (isset($this->request_param['user'])) {
            $user_type     = strpos($this->request_param['user'], '@') !== false ? 'email' : 'phone';
            $this->rules[] = ['user', ['not_empty', $user_type]];
        }

        return $this;
    }

    public function real_name()
    {
        $this->rules = [
            ['truename', ['not_empty']],
            ['cardid', ['not_empty']],
            ['idcard_positive', ['not_empty']],
            ['idcard_negative', ['not_empty']],
        ];

        return $this;
    }
}